<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="common.jsp"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html lang="en">
    <head>        
    	<base href="<%=basePath%>"> 
        <!-- META SECTION -->
        <title>${htmlTitle}</title>            
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1" />
        
        <link rel="icon" href="favicon.ico" type="image/x-icon" />
        <!-- END META SECTION -->
        
        <!-- CSS INCLUDE -->        
        <link rel="stylesheet" type="text/css" id="theme" href="static/css/theme-default.css"/>
        <!-- EOF CSS INCLUDE -->             
        
        <style type="text/css">
        	.btn-default:hover {
			  background-color: #9EFB9D;
			  border-color: #9EFB9D;
			}
			
			.btn-default:focus {
				background: #3A9839;
       		    border-color:#3A9839;
			}
			
			.btn-default.active {
				color: #FFF;
			}
			
			.model_css {
				background: #3A9839;
       		    border-color:#3A9839;
       		    color : #FFF;
			}
        </style>                       
    </head>
    <body>
        
        <div class="login-container">
        
            <div class="login-box animated fadeInDown">
                <div class="login-logo"></div>
                <div class="login-body">
                    <div class="login-title">
                    	<strong>欢迎</strong>, 请您先登录
                    </div>
                    <form action="" class="form-horizontal" method="get" onsubmit="return false;">
                    <div class="form-group">
                    	<div class="col-md-12">
                            <input type="text" class="form-control" id="username" placeholder="Username"/>
                        </div>
                    </div>
                    <div class="form-group">
                    	<div class="col-md-12">
                            <input type="password" class="form-control" id="password" placeholder="Password"/>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-md-12">
                            <button onclick="login()" class="btn btn-info btn-block">登&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;录</button>
                        </div>
                    </div>
                    </form>
                </div>
                <div class="login-footer">
                    <div class="pull-left">
                        &copy; 2017 智能停车
                    </div>
                    <!-- 
                    <div class="pull-right">
                        <a href="#">About</a> |
                        <a href="#">Privacy</a> |
                        <a href="#">Contact Us</a>
                    </div>
                     -->
                </div>
            </div>
        </div>
        
        <script type="text/javascript">
        function login()
		{
			var username = $('#username').val();
			var password = $('#password').val();
			var url = "<%=basePath%>signin";
			$.ajax( url, {
					async: false,
				    type: 'post',
				    data: { account:username, password:password },
				    success: function(result){
				    	var rtn = JSON.parse(result);
				    	if(rtn.code == 1)
				    	{
				    		window.location = "<%=basePath%>home";
						} else {
							$("#message-box-sound").addClass("open");
							$("#errText").html(rtn.text);
						}
					}
				});
			return false;
		}
        </script>
    </body>
</html>